//
//  main.cpp
//  类的访问修饰符
//
//  Created by linjinzhu on 2017/7/11.
//  Copyright © 2017年 baidu. All rights reserved.
//

#include <iostream>

using namespace std;


// public private protected
/// 基类
class Box {
public:
    double length;
    void setWidth(double w);
    double getWidth();

private:
    double width;
protected:
    double height;
};

void Box::setWidth(double w) {
    width = w;
}

double Box::getWidth() {
    return width;
}

/// 继承类
class BigBox:Box {
public:
    void setHeight(double h);
    double getHeight();
};

void BigBox::setHeight(double h) {
    cout << "will set heigth" << endl;
    height = h;
    cout << "did set heigth" << endl;
}

double BigBox::getHeight() {
    return height;
}


/// 主函数
int main(int argc, const char * argv[]) {

    Box box;
    box.length = 1;
    box.setWidth(2);
    cout << box.getWidth() << endl;

    BigBox big;
    big.setHeight(1000);
    cout << big.getHeight() << endl;

    return 0;
}
